package com.foreknow.eldclient.dao;

import com.foreknow.eldclient.po.OrderDetailet;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface OrderDetailetMapper {
    /**
     * 新增多条订单明细            //有问题
     * @param orderDetailet
     * @return
     * @throws Exception
     */
    @Insert("insert into orderdetailet(orderId,foodId,quantity) values (#{orderId},#{foodId},#{quantity})")
    public int saveOrderDetailetBatch(OrderDetailet orderDetailet) throws Exception;

    /**
     * 一  对   多
     * 订单   订单详细
     * 列出指定订单的所有订单明细
     * @param orderId
     * @return
     * @throws Exception
     */
    public List<OrderDetailet> listOrderDetailetByOrderId(Integer orderId) throws Exception;

    @Select("select * from orderdetailet where orderId=#{orderId}")
    List<OrderDetailet> getODByOrderId(int orderId);
}
